Your app is stored on a server, which you can think of as a powerful computer located somewhere. This server is identified on the internet by its IP address, which is a unique number like '164.92.251.81'. As you can see, IP addresses can be hard to remember, which is where domains come in.
A domain, such as 'yoursite.com', is a user-friendly way to access your app on the server. Instead of typing in a complex numbers, you simply enter the domain name. It's like saving a phone number in your contacts under a name; you don't need to remember the number because you remember the name.
How to connect domain with server (DNS setup)?
- Log in to the website where you registered your domain (like GoDaddy, Namecheap, etc.).
- Navigate to the section where you can manage your domain.
2. Locate DNS Settings or DNS Management Area
- This area allows you to manage various DNS records for your domain.
3. Change Nameservers (if necessary)
- Nameservers control where your DNS records are managed.
- If your hosting provider gave you specific nameservers, change them in your domain registrar’s panel.
- They look sth like "ns1.digitalocean.com."
4. Add or Edit A Records
- A Record: Stands for "Address Record" and connects your domain to the IP address of your hosting server.
- Find the option to add an A Record and enter the IP address of your hosting server.
- This directs your domain to your web hosting server when someone types your domain into a browser.
5. Setting Up a WWW Record
- Why WWW Record: Some users may type www before your domain (like www.example.com). To ensure your site is accessible with or without www, you need to set up a record for it.
- Typically, this is done with either a CNAME record.
- CNAME Record for WWW: Points www.yourdomain.com to your main domain yourdomain.com.
- A Record for WWW: Points www.yourdomain.com directly to your hosting server’s IP, just like your main domain.
6. Save Changes and Wait for it to work
- After making changes, save them.
- DNS changes require some time, typically up to 48 hours.
7. Test Your Domain
- 1-2 days later, visit your domain in a web browser to ensure it points to your hosting server.